home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power Programmierung
/
Power-Programmierung (Tewi)(1994).iso
/
magazine
/
drdobbs
/
1991
/
05
/
d_flat
/
button.c
< prev
next >
Wrap
Text File
|
1991-02-18
|
1KB
|
45 lines
/* -------------- button.c -------------- */
#include <conio.h>
#include "dflat.h"
int ButtonProc(WINDOW wnd, MESSAGE msg, PARAM p1, PARAM p2)
{
int rtn, i;
switch (msg) {
case SETFOCUS:
BaseWndProc(BUTTON, wnd, msg, p1, p2);
if (p1)
return TRUE;
case PAINT:
if (isVisible(wnd)) {
background = WndBackground(GetParent(wnd));
foreground = BLACK;
PutWindowChar(wnd, WindowWidth(wnd), 0, 220);
for (i = 0; i < WindowWidth(wnd); i++)
PutWindowChar(wnd, i+1, 1, 223);
WriteTextLine(wnd, NULL, 0, wnd == inFocus);
}
return TRUE;
case KEYBOARD:
if (p1 == '\r') {
PostMessage(GetParent(wnd), COMMAND,
((CTLWINDOW *)(wnd->extension))->command, 0);
return TRUE;
}
break;
case LEFT_BUTTON:
rtn = BaseWndProc(BUTTON, wnd, msg, p1, p2);
PostMessage(GetParent(wnd), COMMAND,
((CTLWINDOW *)(wnd->extension))->command, 0);
return rtn;
case HORIZSCROLL:
return TRUE;
default:
break;
}
return BaseWndProc(BUTTON, wnd, msg, p1, p2);
}